<div class="row">
	<div class="col-xs-12 col-md-12">
		<div class="widget">
			<div class="widget-header bg-blue">
				<i class="widget-icon fa fa-arrow-down"></i>
				<span class="widget-caption">公司列表</span>
				<div class="widget-buttons">
					<a href="#" data-toggle="maximize">
						<i class="fa fa-expand"></i>
					</a>
					<a href="#" data-toggle="collapse">
						<i class="fa fa-minus"></i>
					</a>
					<a href="#" data-toggle="dispose">
						<i class="fa fa-times"></i>
					</a>
				</div>
			</div>
			<div class="widget-body">
				<div class="table-toolbar">
					<a href="{:U('Cms/company/companySet/')}" class="btn btn-primary" data-loader="Ystech-loader" data-loadername="新增公司">
						<i class="fa fa-plus"></i>新增公司
					</a>
					<a href="#" class="btn btn-danger" id="Ystech-delall">
						<i class="fa fa-delicious"></i>全部禁用
					</a>
					<a href="#" class="btn btn-danger" id="Ystech-rebackall">
						<i class="fa fa-delicious"></i>全部启用
					</a>
					<div class="pull-right">
						<form id="Ystech-search">
							<label style="margin-bottom: 0px;">
								<input name="name" type="search" class="form-control input-sm" value="{$name}" placeholder="按部门或部门编号">
							</label>
							<a href="{:U('Cms/Company/comanyList/')}" class="btn btn-success" data-loader="Ystech-loader" data-loadername="公司列表" data-search="Ystech-search">
								<i class="fa fa-search"></i>搜索
							</a>
						</form>
					</div>
				</div>

				<table id="Ystech-table" class="table table-bordered table-hover">
					<thead class="bordered-darkorange">
						<tr role="row">
							<th width="30px"><div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
									<label style="padding-left: 4px;"> <input type="checkbox" class="Ystech-checkall colored-blue">
                                     <span class="text"></span>
									</label>                                    
                                </div></th>
							<th>ID</th>
							<th>公司</th>
							
							<th>状态</th>
							<th>操作</th>
							
						</tr>
					</thead>
					<tbody>
						<volist name="cache" id="vo">
							<tr id="item{$vo.id}">
								<td>
									<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
										<label style="padding-left: 4px;"> <input name="checkvalue" type="checkbox" class="colored-blue Ystech-check" value="{$vo.id}">
	                                     <span class="text"></span>
										</label>                                    
	                                </div>
								</td>
								<td class=" sorting_1">{$vo.id}</td>
								<td class=" ">{$vo.name}</td>
							    
								<td class=" "><if condition="$vo.Status eq 1">启用<else/>禁用</if></td>
								<td class="center "><a href="{:U('Cms/Company/companySet/',array('id'=>$vo['id']))}" class="btn btn-success btn-xs" data-loader="Ystech-loader" data-loadername="设置公司"><i class="fa fa-edit"></i> 编辑</a>&nbsp;&nbsp;<!-- <a class="btn btn-danger btn-xs del" data-type = "del" data-id="{$vo['id']}" data-ajax="{:U('Cms/Dept/deptDel/',array('id'=>$vo['id']))}"><i class="fa fa-trash-o"></i> 禁用</a> --><if condition="$vo.Status eq 1"><a class="btn btn-danger btn-xs del" data-id="{$vo.id}"><i class="fa fa-edit"></i> 禁用</a><else/><a class="btn btn-success btn-xs reback" data-id="{$vo.id}"><i class="fa fa-edit"></i> 启用</a></if></td>
							</tr>
						</volist>
												
					</tbody>
				</table>
				<div class="row DTTTFooter">
					{$page}
				</div>
			</div>
		</div>
	</div>
</div>
<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>
<!--/面包屑导航封装-->
<!--全选特效封装/全部删除-->
<script type="text/javascript">
	//全选
	var checkall=$('#Ystech-table .Ystech-checkall');
	var checks=$('#Ystech-table .Ystech-check');
	var trs=$('#Ystech-table tbody tr');
	$(checkall).on('click',function(){
		if($(this).is(":checked")){			
			$(checks).prop("checked","checked");
		}else{
			$(checks).removeAttr("checked");
		}		
	});
	$(trs).on('click',function(){
		var c=$(this).find("input[type=checkbox]");
		if($(c).is(":checked")){
			$(c).removeAttr("checked");
		}else{
			$(c).prop("checked","checked");
		}		
	});
	//全部禁用
	$('#Ystech-delall').on('click',function(){
		var checks=$(".Ystech-check:checked");
		var chk='';
		$(checks).each(function(){
			chk+=$(this).val()+',';
		});
		if(!chk){
			$.Ystech.alert('danger','请选择要禁用的项目！');
			return false;
		}
		var toajax="{:U('Cms/Company/companyDel')}"+"/id/"+chk;
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.Ystech.ajax('post',toajax,'nodata',callok,callerr);
		}						
		$.Ystech.confirm("确认要禁用吗？",funok);
	});
    //全部启用
    $('#Ystech-rebackall').on('click',function(){
		var checks=$(".Ystech-check:checked");
		var chk='';
		$(checks).each(function(){
			chk+=$(this).val()+',';
		});
		if(!chk){
			$.Ystech.alert('danger','请选择要启用的项目！');
			return false;
		}
		var toajax="{:U('Cms/Company/companyReback')}"+"/id/"+chk;
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.Ystech.ajax('post',toajax,'nodata',callok,callerr);
		}						
		$.Ystech.confirm("确认要启用吗？",funok);
	});
	
	$('.del').on('click',function(){		
		var toajax="{:U('Cms/Company/companyDel')}"+"/id/"+$(this).attr("data-id");
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.Ystech.ajax('post',toajax,'nodata',callok,callerr);
		}						
		$.Ystech.confirm("确认要禁用吗？",funok);
	});

	$('.reback').on('click',function(){		
		var toajax="{:U('Cms/Company/companyReback')}"+"/id/"+$(this).attr("data-id");
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.Ystech.ajax('post',toajax,'nodata',callok,callerr);
		}						
		funok();
	});
	
</script>
<!--/全选特效封装-->
